package com.mall.seckill_mall.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.Future;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

@Data
public class Goods implements Serializable {

    private String goodsId;

    @NotBlank(message = "商品名称不能为空")
    private String goodsName;

    private String goodsDesc;

    @Min(value = 0L, message = "价格最低为0")
    @Max(value = 999999999L, message = "价格最高为999999999")
    private double goodsOldPrice;

    @Min(value = 0L, message = "价格最低为0")
    @Max(value = 999999999L, message = "价格最高为999999999")
    private double goodsPrice;

    @Min(value = 1L, message = "库存最低为1")
    @Max(value = 999999999L, message = "库存最高为999999999")
    private int goodsStock;

    private int goodsCachedStock;

    private String goodsThumb;

    private String goodsPic;

    @NotBlank(message = "商家Id不能为空")
    private String goodsSalerId;

    private int goodsStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date goodsCreateTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date goodsEditTime;

    @Future(message = "开始时间必须是未来的日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    @Future(message = "结束时间必须是未来的日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;
}
